\subsection{Implementation}

The aim of the message handlers is to perform the following operations:
\begin{itemize}
\item	User authentication: This functionality is implemented using a client
	side message handler and a server side message handler. The handler on
	the client side (see ch.ethz.eai.handler.AuthHandler.java) intercepts the outgoing SOAP
	message and to its header a valid "user identity token". 
	The handler on the server side (see ch.ethz.eai.AuthenticationHandler.java) 
	intercepts the incoming SOAP message and checks for this
	token and in case it is present, the message is forwarded, otherwise
	the message is considered to come from an untrusted source and it is
	discarded before reaching the service.

\item	Weather keyword extraction: The user of the application has the option 
	to describe the weather using sentences, not by a set of given keywords.
	However, the webservice only recognizes a limited predefined set of weather statuses
	identified by keywords. These are represented internally by integers. A 
	server side handler (see ch.ethz.eai.handler.InHandler.java) intercepts the incoming 
	SOAP message and try to find
	keywords in the weather status part of the message which match the predefined
	set. In case one of these keywords is found, the weather status string is 
	modified to a string containing the integer which represents the code of that
	keyword. If no keyword is found, the message is discared because
	it is considered to contain an invalid weather status. Another server side handler 
	is configured to intercept the response SOAP message (see ch.ethz.eai.handler.OutHandler.java) 
	and to replace the returned weather status, which is represented by an integer, 
	with the corresponding keyword.

\end{itemize}
All these handlers are implemented using Axis2 API, by extending the AbstractHandler class and
by registering them in the axis2.xml files in the corresponding "InFlow", respectively "OutFlow" phases.

\subsection{Challenges}

The biggest challenge in implementing the SOAP message handlers was to get familiar
with the Axis2 API and configuration files. For instance, in the case of server side 
handlers in order for the handlers to be invoked they only need to be registered in 
the axis2.xml file under the corresponding phase. On the other hand, 
in the case of client side message handler the problem encountered was the fact that 
it is not enough to register the handler in axis2.xml file because this is not used as a
congfiguration context by default. Therefore, it is required to explicitly specify the axis2.xml file as a 
configuration context when the Axis2 ServiceClient object is created, in order for the handler to work.  
	